<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="import" href="../header.html" id="page1">
		<!--标准mui.css-->
		
		<!--App自定义的css-->
		<!-- <link rel="stylesheet" type="text/css" href="../css/app.css" /> -->
		<link href="../../css/mui.picker.css" rel="stylesheet" />
		<link href="../../css/mui.poppicker.css" rel="stylesheet" />
		<style>
			h5 {
				margin: 5px 7px;
			}
		</style>
		<style>
			.mui-btn {
				font-size: 16px;
				padding: 8px;
				margin: 3px;
			}
			h5.mui-content-padded {
				margin-left: 3px;
				margin-top: 20px !important;
			}
			h5.mui-content-padded:first-child {
				margin-top: 12px !important;
			}
			.ui-alert {
				text-align: center;
				padding: 20px 10px;
				font-size: 16px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">新建工单</h1>
		</header>
		<div class="mui-content" id="rrapp">
			<div class="mui-content-padded " style="margin: 5px;">
				<div class="mui-input-row mui-content-padded">
					<label>工单编号</label>
					<input v-model="bussMaintainTask.businessNum" type="text" placeholder="工单编号"  readonly="readonly"></input>
				</div>
				
				<div class="mui-input-row mui-content-padded">
					<label>负责人：</label>
					<input v-model="bussMaintainTask.handlerName" type="text"   readonly="readonly"></input>
				</div>
				
				<div class="mui-input-row mui-content-padded">
					<label>指派时间：</label>
					<input v-model="bussMaintainTask.createTime" type="text" placeholder="工单编号"  readonly="readonly"></input>
				</div>
				<div class="mui-input-row mui-content-padded">
					<label>工单类型：</label>
					<input v-model="bussMaintainTask.typeDesc" type="text" placeholder="工单编号"  readonly="readonly"></input>
				</div>
				<div class="mui-input-row mui-content-padded">
					<label>设备：</label>
					<input v-model="bussMaintainTask.equipmentName" type="text"   readonly="readonly"></input>
				</div>
				<div class="mui-input-row mui-content-padded">
					<label>紧急度：</label>
					<input v-model="bussMaintainTask.gradeNumName" type="text"   readonly="readonly"></input>
				</div>
				<div class="mui-input-row mui-content-padded">
					<label>工单内容：</label>
					<input v-model="bussMaintainTask.content" type="text"   readonly="readonly"></input>
				</div>
				 <div v-if="bussMaintainTask.status=='1' || bussMaintainTask.status=='2'">
					 <div class="mui-input-row mui-content-padded">
					<label>接受时间：</label>
						 {{bussMaintainTask.receiveTime}}
					  </div>
				 </div>
				 
				  <!-- 结果信息 -->
			  <div v-if="bussMaintainTask.status=='2'">
				<div class="mui-input-row mui-content-padded">
				<label>完成时间：</label>
					{{bussMaintainTask.finishTime}}
				</div>
				<div class="mui-input-row mui-content-padded">
				<label>结果状态：</label>
					  <div v-if="bussMaintainTask.resultStatus==0" type="success"> {{bussMaintainTask.resultStatusDesc}}</div>
					  <div v-if="bussMaintainTask.resultStatus==1" type="warning"> {{bussMaintainTask.resultStatusDesc}}</div>
					  <div v-if="bussMaintainTask.resultStatus==2" type="danger"> {{bussMaintainTask.resultStatusDesc}}</div>
				 </div>
				  <div class="mui-input-row mui-content-padded">
				   <label>处理结果：</label>
					 {{bussMaintainTask.resultContent}}
				 </div>
				  
				  
				  <div class="mui-input-row mui-content-padded">
					<img v-for="(item, index) in resultFileIdsArr" :key="index" :src="loadImage(item)" 
						@click="downloadFile(item)" height="100px" style="max-width:100%;overflow:hidden;margin-right:10px;margin-bottom:10px">
					<!-- <iframe v-show="false" :src="ifrUrl"></iframe> -->
				  </div> 
			  </div>
				
				
					
					
					<div class="mui-button-row">
						<button type="button" class="mui-btn mui-btn-danger" @click="fh">返回</button>
					</div>
				<!-- </form> -->
				
				
				
			</div>
		</div>
		
		<!--<script src="../js/mui.picker.min.js"></script>-->
		<script src="../../js/mui.picker.js"></script>
		<script src="../../js/mui.poppicker.js"></script>
		<script src="../../js/city.data.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
		<script>
			(function($, doc) {
				$.init();
					
				
				$.ready(function() {
					console.log('11')
					console.log(T.p("gid"))
			   
				
			})(mui, document);
			})
			
			
			var vm = new Vue({
				el:'#rrapp',
				data:{
					showList: true,
					title: null,
					bussMaintainTask: {
					  id: 0,
					  handler: '',
					  equipmentId: '',
					  resultStatus: 0,
					  type: 0,
					  content: '',
					  gradeNum: '',
					  status: 0,

					  resultContent: '',
					  resultFileIds: '',
					  sourceType: '',
					  resultFileIdsArr:[]
						
					},
					
				},
				methods: {
					getm: function () {
						console.log(T.p("gid"))
						var id = T.p("gid");
						 mui.get(baseUrl+"/buss/bussmaintaintask/info/"+id,function(data,status){
							console.log(data.bussMaintainTask)
							vm.bussMaintainTask = data.bussMaintainTask
							vm.resultFileIdsArr = [];
							  if(data.bussMaintainTask.resultFileIds){
								vm.resultFileIdsArr = vm.bussMaintainTask.resultFileIds.split(',')
							  }
							  console.log(vm.resultFileIdsArr)
						});
						
					},
					loadImage(bytearrayId){
						  return  baseUrl+'/fileAction/loadFile?bytearrayId='+bytearrayId+'&token='+window.localStorage.getItem("token");
					},
					save : function(){
						vm.insIndetailsugtion = {
							handler:vm.handler,
							equipmentId:vm.equipmentId,
							type:vm.type,
							content:vm.content,
							gradeNum:vm.gradeNum
						}
						mui.ajax(baseUrl+'/buss/bussmaintaintask/save?token=17cc536112ef211a993ee256ea019dab',{
							//data:{
								data:JSON.stringify(vm.insIndetailsugtion
								
								),
							//},
							//dataType:'json',//服务器返回json格式数据
							async: false,
							contentType: "application/json",
							type:'post',//HTTP请求类型
							//headers:{'Content-Type':'application/json'},	              
							success:function(data){
								if(data.code == 0){
									mui.toast('添加成功', {
										duration: 'long',
										type: 'div'
									})
								}else{
									mui.toast('添加失败', {
										duration: 'long',
										type: 'div'
									})
								}
								
							},error: function(xhr, type, errorThrown) {
								//异常处理；
								mui.toast('添加失败', {
									duration: 'long',
									type: 'div'
								})
							}
					})
					},
					fh:function(){
					   console.log('返回')
					     mui.openWindow({
							url: "indexgd2.html",
							createNew:true
							});
/* 					   mui.openWindow({
						url: "A页面",
						createNew:true
						});
 */					}
				},
				mounted:function(){
					this.getm();
				}
			});
			

		</script>
	</body>

</html>